package foundation.common.util;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author hernan
 *
 */
public class BusinessException extends RuntimeException {
	
	/**
	 * 
	 */
	public BusinessException() {
		super();
	}

	/**
	 * 
	 * @param exceptionKey
	 */
	public BusinessException(String exceptionKey) {
		super();
		if(this.exceptionsKeys==null) {
			this.exceptionsKeys = new ArrayList<String>();
		}
		this.exceptionsKeys.add(exceptionKey);
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -7063297207008804579L;
	
	private List<ExceptionsKeyParameters> exceptionsKeysParameters;
	
	private List<String> exceptionsKeys;
	
	private List<String> descriptions;

	
	public static final String GENERIC_CODE = ""; 
	
	public void addExceptionKey(String exceptionKey) {
		if(this.exceptionsKeys==null) {
			this.exceptionsKeys = new ArrayList<String>();
		}
		this.exceptionsKeys.add(exceptionKey);
	}
	
//	public void addExceptionKeyParameters(String exceptionKey, String...parameters) {
//		if(this.exceptionsKeysParameters==null) {
//			this.exceptionsKeysParameters = new ArrayList<ExceptionsKeyParameters>();
//		}
//		this.exceptionsKeysParameters.add(new ExceptionsKeyParameters(exceptionKey,parameters));
//	}

	
	public void addExceptionKey(String exceptionKey, String[] parameters) {
		if(this.exceptionsKeysParameters==null) {
			this.exceptionsKeysParameters = new ArrayList<ExceptionsKeyParameters>();
		}
		this.exceptionsKeysParameters.add(new ExceptionsKeyParameters(exceptionKey,parameters));
	}

	public List<String> getExceptionsKeys() {
		return exceptionsKeys;
	}

	public void setExceptionsKeys(List<String> exceptionsKeys) {
		this.exceptionsKeys = exceptionsKeys;
	}
	

	public void addDescription(String description) {
		if(this.descriptions==null) {
			this.descriptions = new ArrayList<String>();
		}
		this.descriptions.add(description);
	}

	public List<String> getDescriptions() {
		return descriptions;
	}

	public void setDescriptions(List<String> descriptions) {
		this.descriptions = descriptions;
	}

	public List<ExceptionsKeyParameters> getExceptionsKeysParameters() {
		return exceptionsKeysParameters;
	}

	public void setExceptionsKeysParameters(
			List<ExceptionsKeyParameters> exceptionsKeysParameters) {
		this.exceptionsKeysParameters = exceptionsKeysParameters;
	}

}
